<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>时间管理</title>
    <script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
    <style>
      body {
        background-color: #000;
        color: #fff;
      }
      #daily-summary {
        width: 100%;
        height: 200px;
      }
    </style>
  </head>
  <body>
    <h1>今日任务</h1>

    <input type="text" id="new-task" placeholder="输入任务名称" />
    <input type="number" id="new-task-score" placeholder="输入任务分数" />
    <button id="add-task">添加任务</button>

    <ul id="task-list">
      <li data-score="10">
        <input type="checkbox" id="task1" />
        <label for="task1">任务1</label>
        <span>(10分)</span>
        <button class="delete">删除</button>
      </li>

      <li data-score="20">
        <input type="checkbox" id="task2" />
        <label for="task2">任务2</label>
        <span>(20分)</span>
        <button class="delete">删除</button>
      </li>
      <li data-score="30">
        <input type="checkbox" id="task3" />
        <label for="task3">任务3</label>
        <span>(30分)</span>
        <button class="delete">删除</button>
      </li>

      <li data-score="15">
 	 <input type="checkbox" id="task4" />
 	 <label for="task5">学习专业课</label>
 	 <span>(15分)</span>
	 <button class="delete">删除</button>
	</li>
<li data-score="15"> <input type="checkbox" id="task4" /> <label for="task4">看篇论文</label> <span>(15分)</span> <button class="delete">删除</button> </li>
<li data-score="10"> <input type="checkbox" id="task6" /> <label for="task6">预习与复习计算机学习</label> <span>(10分)</span> <button class="delete">删除</button> </li>
<li data-score="10"> <input type="checkbox" id="task7" /> <label for="task7">学英语单词30个</label> <span>(10分)</span> <button class="delete">删除</button> </li>
<li data-score="10"> <input type="checkbox" id="task8" /> <label for="task8">练习键盘15分钟</label> <span>(10分)</span> <button class="delete">删除</button> </li> 
<li data-score="15"> <input type="checkbox" id="task9" /> <label for="task9">散步</label> <span>(15分)</span> <button class="delete">删除</button> </li> 
<li data-score="20"> <input type="checkbox" id="task10" /> <label for="task10">看手机屏幕少于6小时一天</label> <span>(20分)</span> <button class="delete">删除</button> </li> 
<li data-score="15"> <input type="checkbox" id="task11" /> <label for="task11">不玩游戏或少于15分钟</label> <span>(15分)</span> <button class="delete">删除</button> </li>
<li data-score="20"> <input type="checkbox" id="task12" /> <label for="task12">反思20分钟（专业课，小说灵感，赚钱方式,交友）</label> <span>(20分)</span> <button class="delete">删除</button> </li>
<li data-score="30"> <input type="checkbox" id="task13" /> <label for="task13">不焦虑</label> <span>(30分)</span> <button class="delete">删除</button> </li>
<li data-score="15"> <input type="checkbox" id="task14" /> <label for="task14">赚钱</label> <span>(15分)</span> <button class="delete">删除</button> </li> 
<li data-score="10"> <input type="checkbox" id="task15" /> <label for="task15">勤洗脸</label> <span>(10分)</span> <button class="delete">删除</button> </li>
<li data-score="20"> <input type="checkbox" id="task16" /> <label for="task16">一天户外运动一小时往上</label> <span>(20分)</span> <button class="delete">删除</button> </li>
<li data-score="10"> <input type="checkbox" id="task17" /> <label for="task17">多喝水</label> <span>(10分)</span> <button class="delete">删除</button> </li>
<li data-score="5"> <input type="checkbox" id="task18" /> <label for="task18">好的句子</label> <span>(5分)</span> <button class="delete">删除</button> </li>
<li data-score="10"> <input type="checkbox" id="task19" /> <label for="task19">减肥</label> <span>(10分)</span> <button class="delete">删除</button> </li> 
<li data-score="10"> <input type="checkbox" id="task20" /> <label for="task20">和同学搞好关系</label> <span>(10分)</span> <button class="delete">删除</button> </li> 
<li data-score="15"> <input type="checkbox" id="task21" /> <label for="task21">和老师搞好关系</label> <span>(15分)</span> <button class="delete">删除</button> </li> 
<li data-score="5"> <input type="checkbox" id="task22" /> <label for="task22">好的歌曲</label> <span>(5分)</span> <button class="delete">删除</button> </li> 
<li data-score="5"> <input type="checkbox" id="task23" /> <label for="task23">说话技巧</label> <span>(10分)</span> <button class="delete">删除</button> </li> 
<li data-score="5"> <input type="checkbox" id="task24" /> <label for="task24">搞笑段子</label> <span>(5分)</span> <button class="delete">删除</button> </li>
<li data-score="5"> <input type="checkbox" id="task25" /> <label for="task25">心理学问</label> <span>(5分)</span> <button class="delete">删除</button> </li>
<li data-score="5"> <input type="checkbox" id="task26" /> <label for="task26">经济学问</label> <span>(5分)</span> <button class="delete">删除</button> </li> 
<li data-score="5"> <input type="checkbox" id="task27" /> <label for="task27">看个实验</label> <span>(5分)</span> <button class="delete">删除</button> </li>
<li data-score="20"> <input type="checkbox" id="task28" /> <label for="task28">学习新技能</label> <span>(20分)</span> <button class="delete">删除</button> </li>
<li data-score="10"> <input type="checkbox" id="task29" /> <label for="task29">不拖延</label> <span>(10分)</span> <button class="delete">删除</button> </li>
<li data-score="10"> <input type="checkbox" id="task30" /> <label for="task30">自我提醒</label> <span>(10分)</span> <button class="delete">删除</button> </li>
<li data-score="10"> <input type="checkbox" id="task31" /> <label for="task31">漂亮的发型</label> <span>(10分)</span> <button class="delete">删除</button> </li>
<li data-score="10"> <input type="checkbox" id="task32" /> <label for="task32">穿搭得体</label> <span>(10分)</span> <button class="delete">删除</button> </li> 
<li data-score="20"> <input type="checkbox" id="task33" /> <label for="task1">每日进入这个界面</label> <span>(20分)</span> <button class="delete">删除</button> </li> 
<li data-score="20"> <input type="checkbox" id="task34" /> <label for="task2">优先级处理得好</label> <span>(20分)</span> <button class="delete">删除</button> </li> 
<li data-score="20"> <input type="checkbox" id="task35" /> <label for="task3">10:30前睡觉</label> <span>(20分)</span> <button class="delete">删除</button> </li>


    </ul>

    <h2>总分：<span id="total-score">0</span></h2>

    <label for="daily-summary">每日简述：</label>
    <textarea id="daily-summary" placeholder="输入每日简述"></textarea>

    <button id="refresh-btn">刷新</button>
    <button id="export-btn">导出</button>

    <script>
      const taskList = document.getElementById("task-list");
      const newTaskInput = document.getElementById("new-task");
      const newTaskScoreInput = document.getElementById("new-task-score");
      const addTaskButton = document.getElementById("add-task");
      const totalScoreElement = document.getElementById("total-score");
      let totalScore = 0;

      const dailySummaryInput = document.getElementById("daily-summary");
      let dailySummary = "";

      const calculateTotalScore = () => {
        let score = 0;
        for (let i = 0; i < taskList.children.length; i++) {
          const taskItem = taskList.children[i];
          const taskScore = parseInt(taskItem.dataset.score);
          if (taskItem.querySelector("input[type=checkbox]").checked) {
            score += taskScore;
          }
        }
        return score;
      };

      addTaskButton.addEventListener("click", () => {
        const taskName = newTaskInput.value;
        const taskScore = parseInt(newTaskScoreInput.value);

        if (!taskName || !taskScore) {
          alert("请输入任务名称和分数！");
          return;
        }

        const taskItem = document.createElement("li");
        taskItem.dataset.score = taskScore;

        const taskCheckbox = document.createElement("input");
        taskCheckbox.type = "checkbox";
        taskCheckbox.id = `task${taskList.childElementCount + 1}`;

        const taskLabel = document.createElement("label");
        taskLabel.htmlFor = `task${taskList.childElementCount + 1}`;
        taskLabel.textContent = taskName;

        const taskScoreSpan = document.createElement("span");
        taskScoreSpan.textContent = `(${taskScore}分)`;

        const deleteButton = document.createElement("button");
        deleteButton.classList.add("delete");
        deleteButton.textContent = "删除";

        taskItem.appendChild(taskCheckbox);
        taskItem.appendChild(taskLabel);
        taskItem.appendChild(taskScoreSpan);
        taskItem.appendChild(deleteButton);

        taskList.appendChild(taskItem);

        totalScore += taskScore;
        totalScoreElement.textContent = totalScore;

        newTaskInput.value = "";
        newTaskScoreInput.value = "";
      });

      taskList.addEventListener("click", (event) => {
        if (event.target.tagName.toLowerCase() === "button") {
          const taskItem = event.target.parentElement;
          const taskScore = parseInt(taskItem.dataset.score);
          taskList.removeChild(taskItem);
          totalScore -= taskScore;
          totalScoreElement.textContent = totalScore;
        }
      });

      dailySummaryInput.addEventListener("input", (event) => {
        dailySummary = event.target.value;
      });

      const refreshButton = document.getElementById("refresh-btn");
      refreshButton.addEventListener("click", () => {
        totalScore = calculateTotalScore();
        totalScoreElement.textContent = totalScore;
      });

      document.getElementById("export-btn").addEventListener("click", () => {
        html2canvas(document.body).then((canvas) => {
          const dataURL = canvas.toDataURL("image/png");
          const link = document.createElement("a");
          link.download = "时间管理.png";
          link.href = dataURL;
          link.click();
        });
      });
    </script>
  </body>
</html>